package main

import "fmt"

func sayHello(){
	for i:= 0; i<10; i++{
		fmt.Println("hello")
	}
}

func sayhello1(){
	//使用defer+recover防止程序整体崩溃
	defer func() {
		if err := recover(); err != nil{
			fmt.Println("error")
		}
	}()
	var m map[int]int
	m[1] = 1
	fmt.Println(m)
}

func main() {
	go sayHello()
	go sayhello1()

	for i := 0; i<10; i++{
		fmt.Println(i)
	}
}